Telegram Group & Telegram Channel
Проверка отношения классов

Для того, чтобы проверить отношения двух классов или экземпляров (является ли класс классом наследником), есть две простые встроенные функции isinstance(object, classinfo) и issubclass(class, classinfo).

instance - возвращает True, если объект является экземпляром класса либо экземпляром подкласса данного класса.
issubclass — проверяет является ли класс наследником другого класса.

Данные функции зачастую применяются в ООП.

#isinstance #issubclass



tg-me.com/python_academy/1996
Create:
Last Update:

Проверка отношения классов

Для того, чтобы проверить отношения двух классов или экземпляров (является ли класс классом наследником), есть две простые встроенные функции isinstance(object, classinfo) и issubclass(class, classinfo).

instance - возвращает True, если объект является экземпляром класса либо экземпляром подкласса данного класса.
issubclass — проверяет является ли класс наследником другого класса.

Данные функции зачастую применяются в ООП.

#isinstance #issubclass

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/1996

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.

A project of our size needs at least a few hundred million dollars per year to keep going,” Mr. Durov wrote in his public channel on Telegram late last year. “While doing that, we will remain independent and stay true to our values, redefining how a tech company should operate.

Python Academy from cn


Telegram Python Academy
FROM USA